/*******************************************************************************
 * 
 * Copyright:
 * 
 * License:
 * 
 * Authors: SALMON Charles
 * 
 ******************************************************************************/

/*******************************************************************************
 * 
 ******************************************************************************/

/**
 * The contextual portlet dynamically adapts it's content to the context
 *
 */
qx.Class.define("bip.views.Portlet",
{
  extend : qx.ui.window.Window,

  /*
  *****************************************************************************
     CONSTRUCTOR
  *****************************************************************************
  */

  /**
   * @param pageModel The page model of the portlet
   * @param title The title of the portlet
   */
  construct : function(pageModel, title)
  {
    this.base(arguments);
    this.maximize();
    this.getChildControl("captionbar").exclude();
    this.__pageModel = pageModel;
    this._createWidgetContent();
    
  },

	/*
	 * ****************************************************************************
	 * PROPERTIES
	 * ****************************************************************************
	 */
	properties : {
		// overridden
		appearance : {
			refine : true,
			init : "portlet"
		}
	},
	
	/*
	*****************************************************************************
	 MEMBERS
	*****************************************************************************
	*/	
	members:
	{	
		__pageModel: null,
		
		/**
		 * Return the page model this portlet belongs to
		 * @return {bip.PageModel} The page model 
		 */
		getPageModel: function() {
			return this.__pageModel;
		},

	  /**
	   * Create the content of the portlet. 
	   * Extending classes must implement this method.
	   */
	  _createWidgetContent : function()
	  {
	  	
	  }
  },
  
	/*
	 * ****************************************************************************
	 * DESTRUCTOR
	 * ****************************************************************************
	 */

	destruct : function() {
		this.__pageModel = null;
		this.base(arguments).dispose();
	}

});
